Use GetNGroups to retrieve the number of group sections in the report.
GetNGroups () RETURNING SMALLINT
PEGetNGroups